<?php

namespace app\model;

class Customer extends CustomerBase
{
    protected $type = [
        'invoice_tax' => 'float',
    ];

    public function salesman()
    {
        return $this->belongsTo(Salesman::class, 'sales_id', 'id');
    }

    public function follows()
    {
        return $this->hasMany(CustomerFollow::class);
    }

    public function latestFollow()
    {
        return $this->hasOne(CustomerFollow::class)->order('id', 'desc');
    }

    public function follow()
    {
        return $this->hasOne(CustomerFollow::class, 'id', 'customer_follow_id');
    }
}
